import 'package:casdon/build_gen/assets.gen.dart';
import 'package:casdon/common/widget/gradient_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:app_settings/app_settings.dart';

class BLENotOpenWidget extends StatelessWidget {
  final VoidCallback? onOpenSettings;

  const BLENotOpenWidget({super.key, this.onOpenSettings});

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.only(
        left: 16.w,
        top: 20.h,
        right: 16.w,
        bottom: 20.h,
      ),
      decoration: BoxDecoration(color: Colors.white),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          // 左侧图标
          SizedBox(
            width: 68.w,
            height: 68.w,
            child: Image.asset(
              Assets.images.permitBle.path,
              fit: BoxFit.contain,
            ),
          ),

          SizedBox(width: 16.w),

          // 中间文字 + 右侧按钮
          Expanded(
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                // 左边文字
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisSize: MainAxisSize.min,
                    children: [
                      Text(
                        '请开启蓝牙、WLAN',
                        style: TextStyle(
                          fontSize: 16.r,
                          fontWeight: FontWeight.w600,
                          color: Colors.black,
                        ),
                      ),
                      SizedBox(height: 4.h),
                      Text(
                        '用户搜索添加智能设备',
                        style: TextStyle(
                          fontSize: 12.r,
                          color: Colors.grey[600],
                        ),
                      ),
                    ],
                  ),
                ),

                // 右侧按钮（始终靠右、上下居中）
                SizedBox(
                  width: 76.w,
                  height: 36.h,
                  child: GradientButton(
                    text: '去开启',
                    borderRadius: 24,
                    onPressed: AppSettings.openAppSettings,
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
